You may have noticed that in the previous examples, we started adding content to the document right after creating the C1PdfDocument object. This is possible because when you create the C1PdfDocument, it automatically adds an empty page to the document, ready to receive any type of content.
When you are done filling up the first page, you can add a new one using the C1PdfDocumentBase.NewPage method.
By default, all pages in the document have the same size and orientation. These parameters can be specified in the C1PdfDocument constructor. You can also change the page size and orientation at any time by setting the C1PdfDocument.PaperKind, C1PdfDocument.PageSize, and C1PdfDocument.Landscape properties. For example, the code below creates a document with all paper sizes defined by the PaperKind enumeration:
You are not restricted to writing on the last page that was added to the document. You can use the C1PdfDocument.CurrentPage property to select which page you want to write to, and then use the regular drawing commands as usual. This is useful for adding content to pages after you are done rendering a document. For example, the code below adds footers to each page containing the current page number and the total of pages in the document (page n of m):
Note that the code uses the C1PdfDocumentBase.Pages property to get the page count. Pages is a collection based on the ArrayList class, and has methods that allow you to count and enumerate pages, as well as add and remove pages at specific positions. You can use the Pages collection to remove pages from certain locations in the document and re-insert them elsewhere.